home *** CD-ROM | disk | FTP | other *** search
/ Mister CD-ROM Magazine 1: 20 Best Action Games / Mister CD-ROM 1.iso / data / lib / graph.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-06-01  |  14.0 KB  |  392 lines

  1. /*      graph.h
  2.  
  3.     Definitions for Graphics Package for DOS and Windows 3.1 (tm).
  4.  
  5.     Copyright (c) Borland International 1992,1993
  6.     All Rights Reserved.
  7. */
  8.  
  9. #if __STDC__
  10. #define _Cdecl
  11. #else
  12. #define _Cdecl  cdecl
  13. #endif
  14.  
  15. #define BCCW #A000
  16.  
  17. #if     !defined(__GRAPHX_DEF_)
  18. #define __GRAPHX_DEF_
  19.  
  20. /* Functions for AVI, Frame, Pixel and WAV manipulation */
  21.    Direitos de Raven Informatica LTDA                   */
  22.  
  23. void       far _PutAVI(int x1, int y1, int x2, int y2, char *nome);
  24. void       far _GetAVI(int x1, int y1, int x2, int y2, char *nome);
  25. void       far _PutFrame(int x1, int y1, int x2, int y2, char *nome);
  26. void       far _GetFrame(int x1, int y1, int x2, int y2, char *nome);
  27. void       far _PutPixel(int x1, int y1, int x2, int y2, char *nome);
  28. void       far _GetPixel(int x1, int y1, int x2, int y2, char *nome);
  29. void       far _PutWAV(int x1, int y1, int x2, int y2, char *nome);
  30. void       far _GetWAV(int x1, int y1, int x2, int y2, char *nome);
  31.  
  32. enum graphics_errors {          /* graphresult error return codes */
  33.     grOk               =   0,
  34.     grNoInitGraph      =  -1,
  35.     grNotDetected      =  -2,
  36.     grFileNotFound     =  -3,
  37.     grInvalidDriver    =  -4,
  38.     grNoLoadMem        =  -5,
  39.     grNoScanMem        =  -6,
  40.     grNoFloodMem       =  -7,
  41.     grFontNotFound     =  -8,
  42.     grNoFontMem        =  -9,
  43.     grInvalidMode      = -10,
  44.     grError            = -11,   /* generic error */
  45.     grIOerror          = -12,
  46.     grInvalidFont      = -13,
  47.     grInvalidFontNum   = -14,
  48.     grInvalidVersion   = -18
  49. };
  50.  
  51. enum graphics_drivers {         /* define graphics drivers */
  52.     DETECT,                 /* requests autodetection */
  53.     CGA, MCGA, EGA, EGA64, EGAMONO, IBM8514,        /* 1 - 6 */
  54.     HERCMONO, ATT400, VGA, PC3270,                  /* 7 - 10 */
  55.     SVGA, UNIVBE, WINDOWS                           /* 11 - 13 */
  56.     CURRENT_DRIVER = -1
  57. };
  58.  
  59. enum graphics_modes {           /* graphics modes for each driver */
  60.     CGAC0      = 0,  /* 320x200 palette 0; 1 page       */
  61.     CGAC1      = 1,  /* 320x200 palette 1; 1 page       */
  62.     CGAC2      = 2,  /* 320x200 palette 2: 1 page       */
  63.     CGAC3      = 3,  /* 320x200 palette 3; 1 page       */
  64.     CGAHI      = 4,  /* 640x200 1 page                  */
  65.     MCGAC0     = 0,  /* 320x200 palette 0; 1 page       */
  66.     MCGAC1     = 1,  /* 320x200 palette 1; 1 page       */
  67.     MCGAC2     = 2,  /* 320x200 palette 2; 1 page       */
  68.     MCGAC3     = 3,  /* 320x200 palette 3; 1 page       */
  69.     MCGAMED    = 4,  /* 640x200 1 page                  */
  70.     MCGAHI     = 5,  /* 640x480 1 page                  */
  71.     EGALO      = 0,  /* 640x200 16 color 4 pages        */
  72.     EGAHI      = 1,  /* 640x350 16 color 2 pages        */
  73.     EGA64LO    = 0,  /* 640x200 16 color 1 page         */
  74.     EGA64HI    = 1,  /* 640x350 4 color  1 page         */
  75.     EGAMONOHI  = 0,  /* 640x350 64K on card, 1 page - 256K on card, 4 pages */
  76.     HERCMONOHI = 0,  /* 720x348 2 pages                 */
  77.     ATT400C0   = 0,  /* 320x200 palette 0; 1 page       */
  78.     ATT400C1   = 1,  /* 320x200 palette 1; 1 page       */
  79.     ATT400C2   = 2,  /* 320x200 palette 2; 1 page       */
  80.     ATT400C3   = 3,  /* 320x200 palette 3; 1 page       */
  81.     ATT400MED  = 4,  /* 640x200 1 page                  */
  82.     ATT400HI   = 5,  /* 640x400 1 page                  */
  83.     VGALO      = 0,  /* 640x200 16 color 4 pages        */
  84.     VGAMED     = 1,  /* 640x350 16 color 2 pages        */
  85.     VGAHI      = 2,  /* 640x480 16 color 1 page         */
  86.     PC3270HI   = 0,  /* 720x350 1 page                  */
  87.     IBM8514LO  = 0,  /* 640x480 256 colors              */
  88.     IBM8514HI  = 1   /*1024x768 256 colors              */
  89. };
  90.  
  91. /* Colors for setpalette and setallpalette */
  92.  
  93. #if     !defined(__COLORS)
  94. #define __COLORS
  95.  
  96. enum COLORS {
  97.     BLACK,                  /* dark colors */
  98.     BLUE,
  99.     GREEN,
  100.     CYAN,
  101.     RED,
  102.     MAGENTA,
  103.     BROWN,
  104.     LIGHTGRAY,
  105.     DARKGRAY,               /* light colors */
  106.     LIGHTBLUE,
  107.     LIGHTGREEN,
  108.     LIGHTCYAN,
  109.     LIGHTRED,
  110.     LIGHTMAGENTA,
  111.     YELLOW,
  112.     WHITE
  113. };
  114. #endif
  115.  
  116. enum CGA_COLORS {
  117.     CGA_LIGHTGREEN     = 1,             /* Palette C0 Color Names       */
  118.     CGA_LIGHTRED       = 2,
  119.     CGA_YELLOW         = 3,
  120.  
  121.     CGA_LIGHTCYAN      = 1,             /* Palette C1 Color Names       */
  122.     CGA_LIGHTMAGENTA   = 2,
  123.     CGA_WHITE          = 3,
  124.  
  125.     CGA_GREEN          = 1,             /* Palette C2 Color Names       */
  126.     CGA_RED            = 2,
  127.     CGA_BROWN          = 3,
  128.  
  129.     CGA_CYAN           = 1,             /* Palette C3 Color Names       */
  130.     CGA_MAGENTA        = 2,
  131.     CGA_LIGHTGRAY      = 3
  132. };
  133.  
  134.  
  135. enum EGA_COLORS {
  136.     EGA_BLACK            =  0,      /* dark colors */
  137.     EGA_BLUE             =  1,
  138.     EGA_GREEN            =  2,
  139.     EGA_CYAN             =  3,
  140.     EGA_RED              =  4,
  141.     EGA_MAGENTA          =  5,
  142.     EGA_BROWN            =  20,
  143.     EGA_LIGHTGRAY        =  7,
  144.     EGA_DARKGRAY         =  56,     /* light colors */
  145.     EGA_LIGHTBLUE        =  57,
  146.     EGA_LIGHTGREEN       =  58,
  147.     EGA_LIGHTCYAN        =  59,
  148.     EGA_LIGHTRED         =  60,
  149.     EGA_LIGHTMAGENTA     =  61,
  150.     EGA_YELLOW           =  62,
  151.     EGA_WHITE            =  63
  152. };
  153.  
  154. enum line_styles {              /* Line styles for get/setlinestyle */
  155.     SOLID_LINE   = 0,
  156.     DOTTED_LINE  = 1,
  157.     CENTER_LINE  = 2,
  158.     DASHED_LINE  = 3,
  159.     USERBIT_LINE = 4,       /* User defined line style */
  160. };
  161.  
  162. enum line_widths {              /* Line widths for get/setlinestyle */
  163.     NORM_WIDTH  = 1,
  164.     THICK_WIDTH = 3,
  165. };
  166.  
  167. enum font_names {
  168.     DEFAULT_FONT    = 0,    /* 8x8 bit mapped font */
  169.     TRIPLEX_FONT    = 1,    /* "Stroked" fonts */
  170.     SMALL_FONT      = 2,
  171.     SANS_SERIF_FONT = 3,
  172.     GOTHIC_FONT     = 4
  173. };
  174.  
  175. #define HORIZ_DIR       0       /* left to right */
  176. #define VERT_DIR        1       /* bottom to top */
  177.  
  178. #define USER_CHAR_SIZE  0       /* user-defined char size */
  179.  
  180. enum fill_patterns {            /* Fill patterns for get/setfillstyle */
  181.     EMPTY_FILL,             /* fills area in background color */
  182.     SOLID_FILL,             /* fills area in solid fill color */
  183.     LINE_FILL,              /* --- fill */
  184.     LTSLASH_FILL,           /* /// fill */
  185.     SLASH_FILL,             /* /// fill with thick lines */
  186.     BKSLASH_FILL,           /* \\\ fill with thick lines */
  187.     LTBKSLASH_FILL,         /* \\\ fill */
  188.     HATCH_FILL,             /* light hatch fill */
  189.     XHATCH_FILL,            /* heavy cross hatch fill */
  190.     INTERLEAVE_FILL,        /* interleaving line fill */
  191.     WIDE_DOT_FILL,          /* Widely spaced dot fill */
  192.     CLOSE_DOT_FILL,         /* Closely spaced dot fill */
  193.     USER_FILL               /* user defined fill */
  194. };
  195.  
  196. enum putimage_ops {             /* BitBlt operators for putimage */
  197.     COPY_PUT,               /* MOV */
  198.     XOR_PUT,                /* XOR */
  199.     OR_PUT,                 /* OR  */
  200.     AND_PUT,                /* AND */
  201.     NOT_PUT                 /* NOT */
  202. };
  203.  
  204. enum text_just {                /* Horizontal and vertical justification
  205.                    for settextjustify */
  206.     LEFT_TEXT       = 0,
  207.     CENTER_TEXT     = 1,
  208.     RIGHT_TEXT      = 2,
  209.  
  210.     BOTTOM_TEXT     = 0,
  211.      /* CENTER_TEXT     = 1,  already defined above */
  212.     TOP_TEXT        = 2
  213. };
  214.  
  215.  
  216. #define MAXCOLORS 15
  217.  
  218. struct palettetype {
  219.     unsigned char size;
  220.     signed char colors[MAXCOLORS+1];
  221. };
  222.  
  223. struct linesettingstype {
  224.     int linestyle;
  225.     unsigned upattern;
  226.     int thickness;
  227. };
  228.  
  229. struct textsettingstype {
  230.     int font;
  231.     int direction;
  232.     int charsize;
  233.     int horiz;
  234.     int vert;
  235. };
  236.  
  237. struct fillsettingstype {
  238.     int pattern;
  239.     int color;
  240. };
  241.  
  242. struct pointtype {
  243.     int x, y;
  244. };
  245.  
  246. struct viewporttype {
  247.     int left, top, right, bottom;
  248.     int clip;
  249. };
  250.  
  251. struct arccoordstype {
  252.     int x, y;
  253.     int xstart, ystart, xend, yend;
  254. };
  255.  
  256. void       far _Cdecl arc(int x, int y, int stangle, int endangle,
  257.               int radius);
  258. void       far _Cdecl bar(int left, int top, int right, int bottom);
  259. void       far _Cdecl bar3d(int left, int top, int right, int bottom,
  260.                 int depth, int topflag);
  261. void       far _Cdecl circle(int x, int y, int radius);
  262. void       far _Cdecl cleardevice(void);
  263. void       far _Cdecl clearviewport(void);
  264. void       far _Cdecl closegraph(void);
  265. void       far _Cdecl detectgraph(int far *graphdriver,int far *graphmode);
  266. void       far _Cdecl drawpoly(int numpoints, int far *polypoints);
  267. void       far _Cdecl ellipse(int x, int y, int stangle, int endangle,
  268.                   int xradius, int yradius);
  269. void       far _Cdecl fillellipse( int x, int y, int xradius, int yradius );
  270. void       far _Cdecl fillpoly(int numpoints, int far *polypoints);
  271. void       far _Cdecl floodfill(int x, int y, int border);
  272. void       far _Cdecl getarccoords(struct arccoordstype far *arccoords);
  273. void       far _Cdecl getaspectratio(int far *xasp, int far *yasp);
  274. int        far _Cdecl getbkcolor(void);
  275. int        far _Cdecl getcolor(void);
  276. struct palettetype * far _Cdecl getdefaultpalette( void );
  277. char *     far _Cdecl getdrivername( void );
  278. void       far _Cdecl getfillpattern(char far *pattern);
  279. void       far _Cdecl getfillsettings(struct fillsettingstype far *fillinfo);
  280. int        far _Cdecl getgraphmode(void);
  281. void       far _Cdecl getimage(int left, int top, int right, int bottom,
  282.                    void far *bitmap);
  283. void       far _Cdecl getlinesettings(struct linesettingstype far *lineinfo);
  284. int        far _Cdecl getmaxcolor(void);
  285. int        far _Cdecl getmaxmode(void);
  286. int        far _Cdecl getmaxx(void);
  287. int        far _Cdecl getmaxy(void);
  288. char *     far _Cdecl getmodename( int mode_number );
  289. void       far _Cdecl getmoderange(int graphdriver, int far *lomode,
  290.                    int far *himode);
  291. unsigned   far _Cdecl getpixel(int x, int y);
  292. void       far _Cdecl getpalette(struct palettetype far *palette);
  293. int        far _Cdecl getpalettesize( void );
  294. void       far _Cdecl gettextsettings(struct textsettingstype far *texttypeinfo);
  295. void       far _Cdecl getviewsettings(struct viewporttype far *viewport);
  296. int        far _Cdecl getx(void);
  297. int        far _Cdecl gety(void);
  298. void       far _Cdecl graphdefaults(void);
  299. char *     far _Cdecl grapherrormsg(int errorcode);
  300. void       far _Cdecl _graphfreemem(void far *ptr, unsigned size);
  301. void far * far _Cdecl _graphgetmem(unsigned size);
  302. int        far _Cdecl graphresult(void);
  303. unsigned   far _Cdecl imagesize(int left, int top, int right, int bottom);
  304. void       far _Cdecl initgraph(int  far *graphdriver,
  305.                 int  far *graphmode,
  306.                 char far *pathtodriver);
  307. int        far _Cdecl installuserdriver( char far *name, int huge (*detect)(void) );
  308. int        far _Cdecl installuserfont( char far *name );
  309. void       far _Cdecl line(int x1, int y1, int x2, int y2);
  310. void       far _Cdecl linerel(int dx, int dy);
  311. void       far _Cdecl lineto(int x, int y);
  312. void       far _Cdecl moverel(int dx, int dy);
  313. void       far _Cdecl moveto(int x, int y);
  314. void       far _Cdecl outtext(char far *textstring);
  315. void       far _Cdecl outtextxy(int x, int y, char far *textstring);
  316. void       far _Cdecl pieslice(int x, int y, int stangle, int endangle,
  317.                    int radius);
  318. void       far _Cdecl putimage(int left, int top, void far *bitmap, int op);
  319. void       far _Cdecl putpixel(int x, int y, int color);
  320. void       far _Cdecl rectangle(int left, int top, int right, int bottom);
  321. void       far _Cdecl restorecrtmode(void);
  322. void       far _Cdecl sector( int X, int Y, int StAngle, int EndAngle,
  323.                   int XRadius, int YRadius );
  324. void       far _Cdecl setactivepage(int page);
  325. void       far _Cdecl setallpalette(struct palettetype far *palette);
  326. void       far _Cdecl setaspectratio( int xasp, int yasp );
  327. void       far _Cdecl setbkcolor(int color);
  328. void       far _Cdecl setcolor(int color);
  329. void       far _Cdecl setfillpattern(char far *upattern, int color);
  330. void       far _Cdecl setfillstyle(int pattern, int color);
  331. unsigned   far _Cdecl setgraphbufsize(unsigned bufsize);
  332. void       far _Cdecl setgraphmode(int mode);
  333. void       far _Cdecl setlinestyle(int linestyle, unsigned upattern,
  334.                    int thickness);
  335. void       far _Cdecl setpalette(int colornum, int color);
  336. void       far _Cdecl setrgbpalette(int colornum,
  337.                     int red, int green, int blue);
  338. void       far _Cdecl settextjustify(int horiz, int vert);
  339. void       far _Cdecl settextstyle(int font, int direction, int charsize);
  340. void       far _Cdecl setusercharsize(int multx, int divx,
  341.                       int multy, int divy);
  342. void       far _Cdecl setviewport(int left, int top, int right, int bottom,
  343.                   int clip);
  344. void       far _Cdecl setvisualpage(int page);
  345. void       far _Cdecl setwritemode( int mode );
  346. int        far _Cdecl textheight(char far *textstring);
  347. int        far _Cdecl textwidth(char far *textstring);
  348.  
  349. /***** graphics drivers *****/
  350.  
  351. int            _Cdecl registerbgidriver(void (*driver)(void));
  352. int        far _Cdecl registerfarbgidriver(void far *driver);
  353.  
  354. /* !!        These "functions" are NOT user-callable          !! */
  355. /* !! They are there just so you can link in graphics drivers !! */
  356.  
  357. void           _Cdecl CGA_driver(void);
  358. void           _Cdecl EGAVGA_driver(void);
  359. void           _Cdecl IBM8514_driver(void);
  360. void           _Cdecl Herc_driver(void);
  361. void           _Cdecl ATT_driver(void);
  362. void           _Cdecl PC3270_driver(void);
  363.  
  364. extern int far _Cdecl CGA_driver_far[];
  365. extern int far _Cdecl EGAVGA_driver_far[];
  366. extern int far _Cdecl IBM8514_driver_far[];
  367. extern int far _Cdecl Herc_driver_far[];
  368. extern int far _Cdecl ATT_driver_far[];
  369. extern int far _Cdecl PC3270_driver_far[];
  370.  
  371.  
  372. /***** graphics fonts *****/
  373.  
  374. int            _Cdecl registerbgifont(void (*font)(void));
  375. int        far _Cdecl registerfarbgifont(void far *font);
  376.  
  377. /* !!   These "functions" are NOT user-callable,   !! */
  378. /* !! they are there just so you can link in fonts !! */
  379.  
  380. void           _Cdecl   triplex_font(void);
  381. void           _Cdecl     small_font(void);
  382. void           _Cdecl sansserif_font(void);
  383. void           _Cdecl    gothic_font(void);
  384.  
  385. extern int far _Cdecl   triplex_font_far[];
  386. extern int far _Cdecl     small_font_far[];
  387. extern int far _Cdecl sansserif_font_far[];
  388. extern int far _Cdecl    gothic_font_far[];
  389.  
  390.  
  391. #endif
  392.